//== GAIA ============================================================================

//== BEGINNING OF CODE ===============================================================

#include "sagittarius/core/SagittariusCore.h"

#include "sagittarius/unicode/CUnicode.h"
#include "sagittarius/re/reCS.h"

#include <stdio.h>
#include <string.h>
#include <malloc.h>

int main(int argc, char* argv[])
{
    RE_CharSet *tmp, *daset;
	RECS_Range ints;
    
    
    daset = re_createCSEmpty();
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRangeS('c'), daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRangeS('a'), daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRangeS('b'), daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRangeS(0xE6), daset); //æ
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRangeS(0xE2), daset); //â
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRange(0xE01, 0xE16), daset); //ก-ถ
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRange(0x4F5C, 0x52D5), daset); //作-動
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(re_constructRangeS(0x27E6), daset); //⟦
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    //nums
    ints = re_constructRange('1', '9');
    tmp = daset;
    daset = re_uniteRangeSet(ints, daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    //sort
    //re_CSSortInPlace(daset);
    re_CS_qsort(daset->ranges, daset->n, 8);
    printf("daset (sorted): ");
    re_writeCS(1, daset);
    printf("\n");
    
    free(daset);
    
    return 0;
}
